Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

function wfFactory()
{
	this.wrappedJSObject=this;
}

wfFactory.prototype = {
	classDescription: "weather-forecaster api factory",
	classID:          Components.ID("{911ab045-12c5-47fb-87be-a52e1230576c}"),
	contractID:       "@weather-forecaster/wfFactory;1",
	QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),

	getAPI: function(type)
	{
		switch(type)
		{
			case "yahoo":  return Components.classes['@weather-forecaster/yahooAPI;1'].createInstance(Components.interfaces.nsIyahooAPI);
			case "wund": return Components.classes['@weather-forecaster/wundAPI;1'].createInstance(Components.interfaces.nsIwundAPI);
			default: return Components.classes['@weather-forecaster/wundAPI;1'].createInstance(Components.interfaces.nsIwundAPI);
		};
	}
};

var components = [wfFactory];
if ("generateNSGetFactory" in XPCOMUtils)
  var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);  // Firefox 4.0 and higher
else
  var NSGetModule = XPCOMUtils.generateNSGetModule(components);    // Firefox 3.x
